C++ NOTEPAD CLONE - FULL PLUGIN LANGUAGE & SYNTAX SPECIFICATION
BUTTONS CONFIGURATION (buttons.plg)

The buttons.plg file defines the hierarchical structure of cascading menus and
clickable buttons rendered under the main "Plugins" menu. Every statement must
be terminated with a semicolon (;).

Syntax Rules:

submenu "Menu Name";
Opens a cascading submenu container. All subsequent button definitions are
nested inside this menu until closed.

endmenu;
Closes the current active submenu block, returning to the parent menu level.

button "ID" "Button Label" "OptionValue" "ShortcutKey";
Creates a clickable menu item.

ID           : Internal identifier for action bindings.

Button Label : The exact text displayed on the menu (rendered cleanly
without metadata, along with any bound shortcut string).

OptionValue  : The argument string passed to main.bat when the button is
clicked.

ShortcutKey  : Optional keyboard shortcut combination (e.g., "Ctrl+Shift+F",
"F5", "^!A").
Modifiers: '^' for Ctrl, '&' for Shift, '!' for Alt.

Example buttons.plg:
submenu "Optimization Tools";
button "opt_fast" "Run Fast Build" "build_fast" "Ctrl+Shift+B";
submenu "Advanced";
button "opt_clean" "Purge Temp Files" "clean_all" "Ctrl+Shift+X";
endmenu;
endmenu;

SHORTCUTS CONFIGURATION (shortcuts.plg)

The shortcuts.plg file maps standalone keyboard shortcuts directly to backend
options or system command executions without requiring menu interaction.

Syntax Rules:

"ShortcutKey" "OptionValue";
Passes the specified option string to main.bat in the background when the
shortcut is triggered.

"ShortcutKey" exec "SystemCommand";
Directly executes an external command-line instruction or utility.

Example shortcuts.plg:
"F5" "quick_test";
"Ctrl+Alt+P" exec "cmd.exe /c echo Shortcut executed";

SCRIPTING COMMAND LANGUAGE (main.bat execution & output protocol)

When a plugin button or keyboard shortcut is invoked, the editor executes:
main.bat "[fpath]" "[OptionValue]"

The batch script communicates back to the editor engine by echoing explicit
command tokens to standard output:

exec "[system command]"
Executes an external shell command. Supports placeholder expansion.

settext "[text]"
Overwrites the entire contents of the editor window with the given text.

appendtext "[text]"
Appends the given text to the end of the current document buffer.

clear
Wipes all text from the active editor window.

lang "[Language Name]"
Updates the active syntax/language tracker displayed in the window title
(e.g., "C++", "Python", "Normal Text").

font [integer]
Changes the editor display font size (constrained between 8 and 40).

save
Triggers a file save operation (prompts for path if the file is new).

new
Clears the workspace and resets the active file path to start a new document.

msg "[Title]" "[Message Text]"
Triggers a standard Windows message popup box.

closewin "[WindowID]"
Closes a specific active interactive window by its unique ID string.

window "[WindowID]" "[Title]" "[BodyText]" "[DefaultOption]" [ButtonDefinitions...] ;
Builds and opens a custom interactive window with dynamic buttons.

Button Definition Formats:

"ButtonName" "OptionToPass"
(Clicking passes the option back to main.bat)

"ButtonName" act "OptionToPass"
(Triggers action and automatically closes the window)

DYNAMIC PLACEHOLDERS

All plugin commands, shortcuts, and executable strings automatically resolve
the following real-time placeholders before execution:

rootd      : Absolute path of the application root directory

fpath      : Absolute path of the currently active file

fname      : File name including extension (e.g., script.cpp)

fnameo     : File name excluding extension (e.g., script)

currentdir : Directory path containing the currently active file